<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>

    <style>

    </style>
</head>

<script>

    try {
        null()  // 将基本数据当做引用数据类型(函数)使用, 会产生TypeError错误
    } catch (error) {
        console.log(error.message)
        console.log(error.stack)
    }

    console.log('我不会因为上面抛出错误而被阻断运行')


    try {
        throw 1
    } catch (error) {
        console.log(error)
    }
    try {
        throw 'good'
    } catch (error) {
        console.log(error)
    }
    try {
        throw true
    } catch (error) {
        console.log(error)
    }
    try {
        throw null
    } catch (error) {
        console.log(error)
    }
    try {
        throw undefined
    } catch (error) {
        console.log(error)
    }
    try {
        throw {}
    } catch (error) {
        console.log(error)
    }
    try {
        throw new Error('抛出一个错误类型的错误')
    } catch (error) {
        console.log(error)
    }

</script>

<body>

</body>

</html>